home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Text / ChangeTextStyleRec / ChangeTextStyleRec.p
Encoding:
Text File  |  1992-07-15  |  1.3 KB  |  43 lines  |  [TEXT/MPS ]

  1. { ChangeTextStyleRec(): Uses the given source TextStyle to modify the
  2.   given target TextStyle according to the given mode, in a manner
  3.   similar to that used in TTEView.SetOneStyle().  For the definitions
  4.   of doAll, doFace, etc., see IM v5 p269. }
  5.   
  6. PROCEDURE ChangeTextStyleRec(
  7.                        theMode:        INTEGER;
  8.                    VAR source:         TextStyle;  { not changed }
  9.                    VAR target:         TextStyle);
  10.    BEGIN
  11.    IF (theMode  = doAll])
  12.    THEN
  13.        target := source
  14.    ELSE
  15.        BEGIN
  16.        IF BAND(theMode, doFont) <> 0
  17.        THEN
  18.            target.tsFont := source.tsFont;
  19.  
  20.        IF BAND(theMode, doPlusFace) <> 0
  21.        THEN
  22.            target.tsFace := target.tsFace + source.tsFace
  23.        ELSE IF BAND(theMode, doMinusFace) <> 0
  24.        THEN
  25.            target.tsFace := target.tsFace - source.tsFace
  26.        ELSE IF BAND(theMode, doFace) <> 0
  27.        THEN
  28.            target.tsFace := source.tsFace;
  29.  
  30.        IF BAND(theMode, doColor) <> 0
  31.        THEN
  32.            target.tsColor := source.tsColor;
  33.  
  34.        IF BAND(theMode, addSize) <> 0
  35.        THEN
  36.            target.tsSize := target.tsSize + source.tsSize
  37.        ELSE IF BAND(theMode, doSize) <> 0
  38.        THEN
  39.            target.tsSize := source.tsSize;
  40.        END;
  41.    END;  { ChangeTextStyleRec }
  42.  
  43.